home *** CD-ROM | disk | FTP | other *** search
/ Click Press Kit / Click Press Kit.iso / pc / main.dxr / Internal_31_Tracker Parent.ls < prev    next >
Encoding:
Text File  |  2006-05-31  |  9.6 KB  |  356 lines

  1. property pStatus, pMasterList, pCurrentSession, pMainScore, pFirstScore, pSlideShowScore, pTrailerScore, pPosterScore, pLogoScore, pNotesScore, pSaveScore, pSummaryScore, pGeneralList, pSectionList, pDownLoadList, pPhotoViewList, pDSWPath, pDSWFolderExists, pFileName, pDSWFileExists, p12345, pFullPath, pTesterURL, pFlashPaperViewList, pConnectedToInternet, pFlashSprite
  2. global gTracker, gMaster, gNetQueue, gRecordSet, gTempList
  3.  
  4. on new me
  5.   pFlashPaperViewList = []
  6.   pTesterURL = "http://tracking.exposurelab.com/12345.txt"
  7.   p12345 = EMPTY
  8.   pConnectedToInternet = "no"
  9.   pGeneralList = [#sessionID: 0, #pkID: 0, #startDateTime: 0, #endDateTime: 0, #screenheight: 0, #screenwidth: 0, #screendepth: 0, #platform: 0]
  10.   pSectionList = [#main: 0, #first: 0, #gallery: 0, #slideshow: 0, #trailer: 0, #poster: 0, #logos: 0, #notes: 0, #summary: 0, #flashpaper: 0, #website: 0]
  11.   pDownLoadList = []
  12.   pPhotoViewList = []
  13.   pStatus = "on"
  14.   pFileName = "stats.txt"
  15.   if the platform contains "Mac" then
  16.     vDisks = baDiskList()
  17.     pDSWPath = vDisks[1] & "dswMedia"
  18.   else
  19.     vDisks = baDiskList()
  20.     repeat with x = 1 to vDisks.count
  21.       if vDisks[x] contains "c" then
  22.         vTemp = vDisks[x]
  23.         exit repeat
  24.       end if
  25.     end repeat
  26.     pDSWPath = vTemp & "dswMedia"
  27.   end if
  28.   pDSWFolderExists = baFolderExists(pDSWPath)
  29.   if pDSWFolderExists = 1 then
  30.     vpath = pDSWPath & gMaster.pPlatformSymbol & pFileName
  31.     pDSWFileExists = baFileExists(vpath)
  32.   else
  33.     pDSWFileExists = 0
  34.   end if
  35.   pFullPath = pDSWPath & gMaster.pPlatformSymbol & pFileName
  36.   pFlashSprite = 200
  37.   pGeneralList.startDateTime = the date & " " & the long time
  38.   pGeneralList.screenheight = (the desktopRectList)[1][4]
  39.   pGeneralList.screenwidth = (the desktopRectList)[1][3]
  40.   pGeneralList.screendepth = (the environment).colorDepth
  41.   pGeneralList.platform = (the environment).platform
  42.   return me
  43. end
  44.  
  45. on stepFrame me
  46. end
  47.  
  48. on mAddFlashPaperView me, vWhichFlashPaper
  49.   pFlashPaperViewList.add(vWhichFlashPaper)
  50. end
  51.  
  52. on mCheckForPrevious me
  53.   if p12345 = EMPTY then
  54.     exit
  55.   else
  56.     if pDSWFileExists = 1 then
  57.     else
  58.       nothing()
  59.     end if
  60.   end if
  61. end
  62.  
  63. on mWrapUpTracker me
  64.   if p12345 = EMPTY then
  65.     vTempList = []
  66.     add(vTempList, pGeneralList)
  67.     add(vTempList, pSectionList)
  68.     add(vTempList, pDownLoadList)
  69.     add(vTempList, pPhotoViewList)
  70.     add(vTempList, pFlashPaperViewList)
  71.     if pDSWFileExists = 1 then
  72.       gTracker.mReadConvertAddReWrite(vTempList)
  73.     else
  74.       gTracker.mWriteString("[" & string(vTempList) & "]")
  75.     end if
  76.   else
  77.     gTracker.mDeleteFileFromFolder()
  78.   end if
  79. end
  80.  
  81. on mNoInterNetConnection me
  82.   if p12345 = EMPTY then
  83.     gTracker.pGeneralList.endDateTime = the date & " " & the long time
  84.     vTempList = []
  85.     add(vTempList, pGeneralList)
  86.     add(vTempList, pSectionList)
  87.     add(vTempList, pDownLoadList)
  88.     add(vTempList, pPhotoViewList)
  89.     add(vTempList, pFlashPaperViewList)
  90.     if pDSWFolderExists = 1 then
  91.       if pDSWFileExists = 1 then
  92.         gTracker.mReadConvertAddReWrite(vTempList)
  93.       else
  94.         gTracker.mWriteString("[" & string(vTempList) & "]")
  95.       end if
  96.     else
  97.       baCreateFolder(gTracker.pDSWPath)
  98.       gTracker.mWriteString("[" & string(vTempList) & "]")
  99.     end if
  100.   end if
  101. end
  102.  
  103. on mCheckInternetConnection me
  104.   gNetQueue.mGetNetText(pTesterURL, #mFileTheResults, gNetQueue)
  105.   gNetQueue.pStartTimer = the timer
  106.   gNetQueue.pStepframe = "waiting"
  107. end
  108.  
  109. on mReadConvertAddReWrite me, vList
  110.   vString = gTracker.mReadFile()
  111.   gTempList = []
  112.   gTempList = value(vString)
  113.   vCount = gTempList.count
  114.   add(gTempList, vList)
  115.   put string(gTempList)
  116.   gTracker.mDeleteFileFromFolder()
  117.   gTracker.mWriteString(string(gTempList))
  118. end
  119.  
  120. on mStartTracker me
  121. end
  122.  
  123. on mDeleteFileFromFolder me
  124.   Ok = baDeleteFile(pFullPath)
  125.   pDSWFileExists = 0
  126. end
  127.  
  128. on mReadFile me
  129.   myFile = new(xtra("fileIO"))
  130.   fileName = gTracker.pFullPath
  131.   if fileName <> EMPTY then
  132.     myFile.openfile(fileName, 1)
  133.     vTempString = myFile.readFile()
  134.   end if
  135.   vTempList = []
  136.   vTempList = value(vTempString)
  137.   put "vTempList count: " & vTempList.count
  138.   myFile.closeFile()
  139.   if offset("&", vTempString) > 0 then
  140.     vTempString = "[" & vTempString & "]"
  141.     mainText = vTempString
  142.   else
  143.     mainText = vTempString
  144.   end if
  145.   myFile = 0
  146.   return mainText
  147. end
  148.  
  149. on mReadStoredData me
  150.   myFile = new(xtra("fileIO"))
  151.   fileName = gTracker.pFullPath
  152.   if fileName <> EMPTY then
  153.     myFile.openfile(fileName, 1)
  154.     vTempString = myFile.readFile()
  155.   end if
  156.   vTempList = []
  157.   vTempList = value(vTempString)
  158.   gRecordSet.pMasterList = vTempList
  159.   myFile.closeFile()
  160.   myFile = 0
  161.   gRecordSet.mProcessStoredRecordSet()
  162. end
  163.  
  164. on mReplaceText me, mainText, SearchString, replaceString
  165.   theReplaceLen = SearchString.length - 1
  166.   charStart = offset(SearchString, mainText)
  167.   repeat while charStart <> 0
  168.     if charStart <> 0 then
  169.       put replaceString into mainText.char[charStart..charStart + theReplaceLen]
  170.       charStart = offset(SearchString, mainText)
  171.       next repeat
  172.     end if
  173.     put SearchString && "not found in text"
  174.   end repeat
  175.   return mainText
  176. end
  177.  
  178. on mAddPhotoView me, vWhichPhoto
  179.   pPhotoViewList.add(vWhichPhoto)
  180. end
  181.  
  182. on mAddDownLoad me, vType, vName
  183.   if (vType = "doc") or (vType = "pdf") then
  184.     case gMaster.pLanguageMode of
  185.       "english":
  186.         vType = "E" & vType
  187.       "spanish":
  188.         vType = "S" & vType
  189.     end case
  190.   end if
  191.   vList = [vType, vName]
  192.   pDownLoadList.add(vList)
  193. end
  194.  
  195. on mPutListsToString me
  196.   global gTempList
  197.   vText = "[" & string(pGeneralList) & ", " & string(pSectionList) & ", " & string(pDownLoadList) & ", " & string(pPhotoViewList) & "]"
  198.   gTempList = []
  199.   gTempList = value(vText)
  200.   put gTempList & RETURN & RETURN
  201.   put gTempList[1] & RETURN & RETURN
  202.   put gTempList[2] & RETURN & RETURN
  203.   put gTempList[3] & RETURN & RETURN
  204.   put gTempList[4] & RETURN & RETURN
  205. end
  206.  
  207. on mAddSection me, vWhichSection
  208.   case vWhichSection of
  209.     "main":
  210.       vCount = pSectionList.main
  211.       pSectionList.main = vCount + 1
  212.     "first":
  213.       vCount = pSectionList.first
  214.       pSectionList.first = vCount + 1
  215.     "1g", "2g", "3g", "4g", "5g", "6g", "7g", "8g", "9g", "10g":
  216.       vCount = pSectionList.gallery
  217.       pSectionList.gallery = vCount + 1
  218.     "slideshow":
  219.       vCount = pSectionList.slideshow
  220.       pSectionList.slideshow = vCount + 1
  221.     "trailer":
  222.       vCount = pSectionList.trailer
  223.       pSectionList.trailer = vCount + 1
  224.     "poster":
  225.       vCount = pSectionList.poster
  226.       pSectionList.poster = vCount + 1
  227.     "logos":
  228.       vCount = pSectionList.logos
  229.       pSectionList.logos = vCount + 1
  230.     "FP1", "FP1s", "FP2", "FP2s", "FP3", "FP3s":
  231.       vCount = pSectionList.notes
  232.       pSectionList.notes = vCount + 1
  233.     "notes":
  234.       vCount = pSectionList.notes
  235.       pSectionList.notes = vCount + 1
  236.     "save1", "save2", "save3":
  237.       vCount = pSectionList.summary
  238.       pSectionList.summary = vCount + 1
  239.     "website":
  240.       vCount = pSectionList.website
  241.       pSectionList.website = vCount + 1
  242.   end case
  243. end
  244.  
  245. on mWriteString me, vString
  246.   vFileIOObj = 0
  247.   vFileIOObj = new(xtra("fileIO"))
  248.   if the platform contains "mac" then
  249.     setFilterMask(vFileIOObj, "TEXT")
  250.   else
  251.     setFilterMask(vFileIOObj, "Text Files,*.txt,All Files,*.*")
  252.   end if
  253.   createFile(vFileIOObj, pFullPath)
  254.   openfile(vFileIOObj, pFullPath, 0)
  255.   yyy = writeString(vFileIOObj, vString)
  256.   closeFile(vFileIOObj)
  257.   vFileIOObj = 0
  258. end
  259.  
  260. on mAppendString me, vString
  261.   vString2 = "&" & vString
  262.   vFileIOObj = new(xtra("fileIO"))
  263.   if the platform contains "mac" then
  264.     setFilterMask(vFileIOObj, "TEXT")
  265.   else
  266.     setFilterMask(vFileIOObj, "Text Files,*.txt,All Files,*.*")
  267.   end if
  268.   openfile(vFileIOObj, pFullPath, 0)
  269.   setPosition(vFileIOObj, getLength(vFileIOObj))
  270.   writeString(vFileIOObj, vString2)
  271.   closeFile(vFileIOObj)
  272.   vFileIOObj = 0
  273. end
  274.  
  275. on mWriteDataOLD me
  276.   global gMasterFolder
  277.   fileObj2 = new(xtra("fileIO"))
  278.   vpath = the moviePath
  279.   vTemp = vpath & "Captions.txt"
  280.   vTemp2 = vpath & "Captions.txt"
  281.   if the platform contains "Mac" then
  282.     vDisks = baDiskList()
  283.   else
  284.     vDisks = baDiskList()
  285.   end if
  286.   vDisks = baDiskList()
  287.   pSystemFolderPath = baSysFolder("system")
  288.   pDSWMediaPath = pSystemFolderPath & "dswmedia"
  289.   vOK = 0
  290.   if baFileExists(vTemp) = 1 then
  291.     vOK = 1
  292.   else
  293.     vOK = 0
  294.   end if
  295.   if vOK = 1 then
  296.     vMasterPath = gMasterFolder
  297.   else
  298.     if baFileExists(vTemp2) = 1 then
  299.       vOK = 2
  300.       vMasterPath = gMasterFolder
  301.     else
  302.       vOK = 0
  303.       vMasterPath = gMasterFolder
  304.     end if
  305.   end if
  306.   case vOK of
  307.     0:
  308.       saveText2(vTemp2, gMaster.pCaption1, gMaster.pCaption2, gMaster.pCaption3)
  309.     1, 2:
  310.       openfile(fileObj2, vTemp2, 0)
  311.       if status(fileObj2) <> 0 then
  312.         err = error(fileObj2, status(fileObj2))
  313.         alert("Error:" && err)
  314.         return EMPTY
  315.       end if
  316.       vText = readFile(fileObj2)
  317.       closeFile(fileObj2)
  318.       saveText1(vText, vTemp2, gMaster.pCaption3)
  319.   end case
  320. end
  321.  
  322. on mAddActor me
  323.   add(the actorList, me)
  324. end
  325.  
  326. on mDeleteActor me
  327.   where = getOne(the actorList, me)
  328.   if where > 0 then
  329.     deleteAt(the actorList, where)
  330.   end if
  331. end
  332.  
  333. on mSerializeRecordSet me
  334.   vFlashSprite = 200
  335.   vFieldsList = ["aaa", "bbb", "ccc"]
  336.   vFieldCount = vFieldsList.count
  337.   vRecordsList = [["111", "222", "333"], ["444", "555", "666"], ["777", "888", "999"]]
  338.   vRecordCount = vRecordsList.count
  339.   vFields = sprite(vFlashSprite).newObject("Array")
  340.   repeat with i = 1 to vFieldCount
  341.     vFields.push(vFieldsList[i])
  342.   end repeat
  343.   vRecordSet = newObject("RecordSet")
  344.   repeat with i = 1 to vRecordCount
  345.     vRecord = sprite(vFlashSprite).newObject("Object")
  346.     vCount = 0
  347.     repeat with j = 0 to vFieldCount - 1
  348.       vCount = vCount + 1
  349.       vFieldItem = vFieldsList[vCount]
  350.       vRecord.setProp(symbol(vFieldItem), vRecordsList[i][vCount])
  351.     end repeat
  352.     vRecordSet.addItem(vRecord)
  353.   end repeat
  354.   return vRecordSet
  355. end
  356.